﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	x:Class="Faust.Andrew.MTG.Player.FloatingWindow"
	x:Name="Window"
	Width="300" Height="450" ResizeMode="CanResizeWithGrip" Style="{DynamicResource FloatingWindowTemplate}" Background="{DynamicResource WindowBackground}" Closing="Window_Closing" Icon="/MTGPlayer;Component/MTGManagerIcon.ico" Topmost="True">
	<Window.Resources>
		<ControlTemplate x:Key="WindowTemplateKey" TargetType="{x:Type Window}">
			<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
				<Grid>
					<AdornerDecorator>
						<ContentPresenter />
					</AdornerDecorator>
					<ResizeGrip x:Name="WindowResizeGrip" HorizontalAlignment="Right" VerticalAlignment="Bottom" IsTabStop="false" Visibility="Collapsed"/>
				</Grid>
			</Border>
			<ControlTemplate.Triggers>
				<MultiTrigger>
					<MultiTrigger.Conditions>
						<Condition Property="ResizeMode" Value="CanResizeWithGrip"/>
						<Condition Property="WindowState" Value="Normal"/>
					</MultiTrigger.Conditions>
					<Setter Property="Visibility" TargetName="WindowResizeGrip" Value="Visible"/>
				</MultiTrigger>
			</ControlTemplate.Triggers>
		</ControlTemplate>
		<Style x:Key="FloatingWindowTemplate" TargetType="{x:Type Window}">
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
			<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Window}">
						<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
							<AdornerDecorator>
								<ContentPresenter/>
							</AdornerDecorator>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Style.Triggers>
				<Trigger Property="ResizeMode" Value="CanResizeWithGrip">
					<Setter Property="Template" Value="{StaticResource WindowTemplateKey}"/>
				</Trigger>
			</Style.Triggers>
		</Style>
	</Window.Resources>
</Window>